cmake_minimum_required(VERSION 2.8)
project(HRLocomotion_b)

set(PACKAGE_NAME "HRLocomotion")
set(PACKAGE_VERSION "1.0.0")
set(PACKAGE_SO_VERSION "1.0")
set(PACKAGE_DESCRIPTION "MPC Locomotion solver for humanoid robots.")
set(PACKAGE_AUTHOR "Julio Jarquin, Gustavo Arechavaleta.")
set(PACKAGE_MAINTAINER "Julio Jarquin, Gustavo Arechavaleta,.")
set(PACKAGE_URL "https://www.assembla.com/code/naovision/subversion/nodes/33/moveNao-1.0/libHRLocomotion")

set(SRC_FOLDER  src)
set(TEST_FOLDER test)
set(INC_FOLDER  include/${PACKAGE_NAME})

############################################################
################# compile options         ##################
############################################################

option(USE_SINGLE_PRECISION
  "Use single precision for operations (FLOAT) (ON or OFF)"
  OFF)

if(USE_SINGLE_PRECISION)
    message("Using single precision")
    add_definitions(" -D__USE_SINGLE_PRECISION__ ")
    set(QPTARGET  "fqpoases3")
else()
    message("Using double precision")
    set(QPTARGET  "qpoases3")
endif()

add_definitions(" -D_COMPILE_DEBUGGING_METHODS ")


find_package(qibuild)

############################################################
################# configure srcs and dirs ##################
############################################################

file(GLOB src_ ${SRC_FOLDER}/*.cc)
file(GLOB inc_ ${INC_FOLDER}/*.h)
include_directories("include") 
include_directories("../eigen3")

############################################################
############## configure additional packages ###############
############################################################
if(NOT CMAKE_FIND_ROOT_PATH)
  set(CMAKE_FIND_ROOT_PATH)
endif()


############################################################
##############       needed libraries        ###############
############################################################
list(APPEND CMAKE_FIND_ROOT_PATH "/home/airoa/Thesis_work/naoMove/naolibs/qpOASES/build-linux64-release/sdk/cmake")
find_package(${QPTARGET})



qi_create_lib(${PACKAGE_NAME} SHARED ${src_} ${inc_})
qi_use_lib(${PACKAGE_NAME}  ${QPTARGET})
qi_stage_lib(${PACKAGE_NAME})

enable_testing()

SET(test_
        #test_01
        #test_02
        #test_03
        #test_04
        test_05
)
foreach(element ${test_})
	qi_create_test(${element} ${TEST_FOLDER}/${element}.cc)
	qi_use_lib(${element} ${PACKAGE_NAME})
endforeach(element ${test_})
